using Microsoft.Xna.Framework;

namespace SolarWinds.Particles
{
    public interface IParticleForce
    {
        void Update(float elapsedTime, ref Particle p);
    }

    class ParticleForceGravity : IParticleForce
    {
        /// <summary>
        /// Specifies the gravity constant
        /// </summary>
        private readonly Vector3 mGravity = new Vector3(0.0f, -9.81f, 0.0f);

        #region IParticleForce Members

        public void Update(float elapsedTime, ref Particle p)
        {
            // update velocity                
            p.Velocity += elapsedTime * p.Mass * mGravity;
        }

        #endregion
    }

    class ParticleForceWind : IParticleForce
    {
        public ParticleForceWind(Vector3 wind)
        {
            mWind = wind;
        }

        private Vector3 mWind;

        public Vector3 WindDirection
        {
            get { return mWind; }
            set { mWind = value; }
        }

        #region IParticleForce Members

        public void Update(float elapsedTime, ref Particle p)
        {
            p.Velocity += elapsedTime * p.Mass * mWind;
        }

        #endregion
    }
}